import { createHashRouter, Navigate } from 'react-router-dom'

import Login from '@/views/Login'
import MyLayout from '@/views/Layout'
import Home from '@/views/Home'
import CateGory from '@/views/CateGory'
import Cart from '@/views/Cart'
import My from '@/views/My'
import GoodsDetail from '@/views/GoodsDetail'

const router = createHashRouter([
  {
    path: '/login',
    element: <Login />
  },
  {
    path: '/goodsDetail',
    element: <GoodsDetail />
  },
  {
    path: '/',
    element: <Navigate to='/home' />
  },
  {
    path: '/',
    element: <MyLayout />,
    // element: <Navigate  to='/home'/>,
    children: [
      {
        path: 'home',
        element: <Home />
      },
      {
        path: 'category',
        element: <CateGory />
      },
      {
        path: 'cart',
        element: <Cart />
      },
      {
        path: 'my',
        element: <My />
      }
    ]
  }
])

export default router
